<?php 
defined('RUN_KATANA') or die('Restricted access'); 
if(!defined('RUN_IFRAME'))
{
	require('auto.js.php');
	echo '<div id="filtergrid">';
	if(($adc->getCurrentAdTypeId() > 0) && ($adc->getCurrentAdTypeId() < 6) && (!($adc->getCurrentAdCatId() > 0)))
	{ require($adc->getViewPath().'filters/AdCats.php'); }
	else if($adc->getCurrentAdTypeId() == 0)
	{ require($adc->getViewPath().'filters/AdTypes.php'); }
	echo '</div>';
}
$adc->getAds();
$pages = $adc->getPager()->getHTML();
?>
<div class="row-fluid">
	<div class="prospector list row-fluid">
    	<div class="page-info">
            <div class="row-fluid row">
                <div class="span6 w2 col-md-6"><?php //<ul class="breadcrumb">$adc->getBreadcrumb();</ul> ?><?php require($katana->getModPath(50)); ?></div>
                <div class="span6 w2 col-md-6">
                    <div class="pull-right"><?php echo $pages; ?></div>
                </div>
            </div>
        </div>
        <div class="row-fluid row">
        	<?php if(!defined('RUN_IFRAME')): ?>
            <div class="prospect-filter span4 col-md-4">
            	<div class="row-fluid visible-phone visible-sm">
                    <button class="btn btn-block btn-info" data-toggle="collapse" data-target=".filter-form">
                        <?php echo ucfirst($txt->getWord(array('display', 'filter'))); ?>
                    </button>
                </div>
                <form method="get" id="search-ad-form" action="" class="form-search filter-form collapse-phone">
                	<div class="visible-sm visible-phone"><hr /></div>
                    <?php 
                    if(is_file($adc->getViewPath().'Filter'.$adc->CurrentAdType->AdTypeObject.'.php'))
                    { require($adc->getViewPath().'Filter'.$adc->CurrentAdType->AdTypeObject.'.php'); }
                    else
                    { require($adc->getViewPath().'Filter.php'); }
                    ?>
                    <?php require(TEMPLATES_PATH.'sites/'.$katana->getId().'/layout/objects/banners/bannerFilter.php'); ?>
                    <input id="sortorder" type="hidden" name="sortorder" value="<?php if($_REQUEST['sortorder'] != '') { echo $_REQUEST['sortorder']; } else { echo 'date-desc'; }?>" />
                    <input id="pageNo" class="pageNo" type="hidden" name="page" value="1" />
                </form>
            </div>
            <?php endif; ?>
            <div class="prospect-list <?php if(!defined('RUN_IFRAME')): ?> span8 col-md-8 <?php else: ?> span12 col-md-12 <?php endif; ?>">
                <div class="prospect-list-padding">
				<?php 
                if(is_file($adc->getViewPath().'Sorter'.$adc->getCurrentAdTypeId().'.php'))
                { require($adc->getViewPath().'Sorter'.$adc->getCurrentAdTypeId().'.php'); }
                else
                { require($adc->getViewPath().'Sorter.php'); }
                ?><div class="clear"></div>
                <?php 
                if(count($adc->getAds()) > 0)
                {
                    $i = 0;
                    foreach($adc->getAds() as $ad)
                    {
                        if(is_file($adc->getViewPath().get_class($ad).'Item.php'))
                        { require($adc->getViewPath().get_class($ad).'Item.php'); }
                        else
                        {
                            if(is_file($adc->getViewPath().'AdItem.php'))
                            { require($adc->getViewPath().'AdItem.php'); }
                        }
                        echo '<div class="clear"></div>';
                        
						if(!defined('RUN_IFRAME'))
						{
							if(($adc->getSetting('ListBanners') > 0) && (($i%$adc->getSetting('ListBanners')) == 0))
							{
								if(is_file(TEMPLATES_PATH.'sites/'.$katana->getId().'/layout/objects/banners/bannerProspectList-'.$i.'.php'))
								{ require(TEMPLATES_PATH.'sites/'.$katana->getId().'/layout/objects/banners/bannerProspectList-'.$i.'.php'); }
							}
						}
                        $katana->TrackViews['am_ads'][$ad->getId()]['table'] = 'am_ads';
                        $katana->TrackViews['am_ads'][$ad->getId()]['where'] = 'id='.$ad->getId();
                        $katana->TrackViews['am_ads'][$ad->getId()]['set'] = 'ViewsList=ViewsList+1';
                        $i++;
                    }
                }
                else
                { echo $adc->getSetting('NoHitsTxt'); }
                if(is_file($adc->getViewPath().'Sorter'.$adc->getCurrentAdTypeId().'.php'))
                { require($adc->getViewPath().'Sorter'.$adc->getCurrentAdTypeId().'.php'); }
                else
                { require($adc->getViewPath().'Sorter.php'); }
                ?>
                </div>
            </div>
        </div>
		<div class="clear"></div>
        <div class="page-info">
            <div class="row-fluid row">
                <div class="span6 w2 col-md-6"><ul class="breadcrumb"><?php $adc->getBreadcrumb(); ?></ul></div>
                <div class="span6 w2 col-md-6">
                    <div class="pull-right"><?php echo $pages; ?></div>
                </div>
            </div>
        </div>
	</div>
</div>